The section describes the programming interface of the PIT HAL driver.
More...
PIT HAL Driver
Overview
PIT hal driver is a set of APIs to access and configure PIT hardware registers.
| static void pit_hal_enable |
( |
void |
| ) |
|
|
inlinestatic |
This function enables the PIT timer clock (Note: this function does not un-gate the system clock gating control). It should be called before any other timer related setup.
| static void pit_hal_disable |
( |
void |
| ) |
|
|
inlinestatic |
This function disables all PIT timer clocks(Note: it does not affect the SIM clock gating control).
| static void pit_hal_configure_timer_run_in_debug |
( |
bool |
timerRun | ) |
|
|
inlinestatic |
In debug mode, the timers may or may not be frozen, based on the configuration of this function. This is intended to aid software development, allowing the developer to halt the processor, investigate the current state of the system (for example, the timer values), and continue the operation.
- Parameters
-
| timerRun | Timers run or stop in debug mode.
- true: Timers continue to run in debug mode.
- false: Timers stop in debug mode.
|
| static void pit_hal_timer_start |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
After calling this function, timers load the start value as specified by the function pit_hal_set_timer_period_count(uint32_t timer, uint32_t count), count down to 0, and load the respective start value again. Each time a timer reaches 0, it generates a trigger pulse and sets the time-out interrupt flag.
- Parameters
-
| timer | Timer channel number |
| static void pit_hal_timer_stop |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
This function stops every timer from counting. Timers reload their periods respectively after they call the pit_hal_timer_start the next time.
- Parameters
-
| timer | Timer channel number |
| static bool pit_hal_is_timer_started |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
- Parameters
-
| timer | Timer channel number |
- Returns
- Current timer running status -true: Current timer is running. -false: Current timer has stopped.
| static void pit_hal_set_timer_period_count |
( |
uint32_t |
timer, |
|
|
uint32_t |
count |
|
) |
| |
|
inlinestatic |
Timers begin counting from the value set by this function. The counter period of a running timer can be modified by first stopping the timer, setting a new load value, and starting the timer again. If timers are not restarted, the new value is loaded after the next trigger event.
- Parameters
-
| timer | Timer channel number |
| count | Timer period in units of count |
| static uint32_t pit_hal_read_timer_period_count |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
- Parameters
-
| timer | Timer channel number |
- Returns
- Timer period in units of count
| static uint32_t pit_hal_read_timer_count |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
This function returns the real-time timer counting value, in a range from 0 to a timer period.
- Parameters
-
| timer | Timer channel number |
- Returns
- Current timer counting value
| static void pit_hal_configure_interrupt |
( |
uint32_t |
timer, |
|
|
bool |
enable |
|
) |
| |
|
inlinestatic |
If enabled, an interrupt happens when a timeout event occurs (Note: NVIC should be called to enable pit interrupt in system level).
- Parameters
-
| timer | Timer channel number |
| enable | Enable or disable interrupt.
- true: Generate interrupt when timer counts to 0.
- false: No interrupt is generated.
|
| static bool pit_hal_is_interrupt_enabled |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
- Parameters
-
| timer | Timer channel number |
- Returns
- Status of enabled or disabled interrupt
- true: Interrupt is enabled.
- false: Interrupt is disabled.
| static void pit_hal_clear_interrupt_flag |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
This function clears the timer interrupt flag after a timeout event occurs.
- Parameters
-
| timer | Timer channel number |
| static bool pit_hal_is_timeout_occurred |
( |
uint32_t |
timer | ) |
|
|
inlinestatic |
Every time the timer counts to 0, this flag is set.
- Parameters
-
| timer | Timer channel number |
- Returns
- Current status of the timeout flag
- true: Timeout has occurred.
- false: Timeout has not yet occurred.